<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSplitterHandle Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSplitterHandle Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QSplitterHandle class provides handle functionality of the
splitter. <a href="#details">More...</a></p>

<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsplitterhandle.html#QSplitterHandle">__init__</a></b> (<i>self</i>, Qt.Orientation&#160;<i>o</i>, QSplitter&#160;<i>parent</i>)</li><li><div class="fn" />int <b><a href="qsplitterhandle.html#closestLegalPosition">closestLegalPosition</a></b> (<i>self</i>, int&#160;<i>p</i>)</li><li><div class="fn" />bool <b><a href="qsplitterhandle.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qsplitterhandle.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qsplitterhandle.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qsplitterhandle.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qsplitterhandle.html#moveSplitter">moveSplitter</a></b> (<i>self</i>, int&#160;<i>p</i>)</li><li><div class="fn" />bool <b><a href="qsplitterhandle.html#opaqueResize">opaqueResize</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.Orientation <b><a href="qsplitterhandle.html#orientation">orientation</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsplitterhandle.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qsplitterhandle.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qsplitterhandle.html#setOrientation">setOrientation</a></b> (<i>self</i>, Qt.Orientation&#160;<i>o</i>)</li><li><div class="fn" />QSize <b><a href="qsplitterhandle.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />QSplitter <b><a href="qsplitterhandle.html#splitter">splitter</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSplitterHandle class provides handle functionality of the
splitter.</p>
<p>QSplitterHandle is typically what people think about when they
think about a splitter. It is the handle that is used to resize the
widgets.</p>
<p>A typical developer using <a href="qsplitter.html">QSplitter</a>
will never have to worry about QSplitterHandle. It is provided for
developers who want splitter handles that provide extra features,
such as popup menus.</p>
<p>The typical way one would create splitter handles is to subclass
<a href="qsplitter.html">QSplitter</a> then reimplement <a href="qsplitter.html#createHandle">QSplitter.createHandle</a>() to
instantiate the custom splitter handle. For example, a minimum
<a href="qsplitter.html">QSplitter</a> subclass might look like
this:</p>
<pre class="cpp">
 <span class="keyword">class</span> Splitter : <span class="keyword">public</span> <span class="type"><a href="qsplitter.html">QSplitter</a></span>
 {
 <span class="keyword">public</span>:
     Splitter(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>Orientation orientation<span class="operator">,</span> <span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent <span class="operator">=</span> <span class="number">0</span>);

 <span class="keyword">protected</span>:
     <span class="type">QSplitterHandle</span> <span class="operator">*</span>createHandle();
 };
</pre>
<p>The <a href="qsplitter.html#createHandle">createHandle()</a>
implementation simply constructs a custom splitter handle, called
<tt>Splitter</tt> in this example:</p>
<pre class="cpp">
 <span class="type">QSplitterHandle</span> <span class="operator">*</span>Splitter<span class="operator">.</span>createHandle()
 {
     <span class="keyword">return</span> <span class="keyword">new</span> SplitterHandle(orientation()<span class="operator">,</span> <span class="keyword">this</span>);
 }
</pre>
<p>Information about a given handle can be obtained using functions
like <a href="qsplitterhandle.html#orientation">orientation</a>()
and <a href="qsplitterhandle.html#opaqueResize">opaqueResize</a>(),
and is retrieved from its parent splitter. Details like these can
be used to give custom handles different appearances depending on
the splitter's orientation.</p>
<p>The complexity of a custom handle subclass depends on the tasks
that it needs to perform. A simple subclass might only provide a
<a href="qsplitterhandle.html#paintEvent">paintEvent</a>()
implementation:</p>
<pre class="cpp">
 <span class="type">void</span> SplitterHandle<span class="operator">.</span><a href="qsplitterhandle.html#paintEvent">paintEvent</a>(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>event)
 {
     <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
     <span class="keyword">if</span> (orientation() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>Horizontal) {
         gradient<span class="operator">.</span>setStart(rect()<span class="operator">.</span>left()<span class="operator">,</span> rect()<span class="operator">.</span>height()<span class="operator">/</span><span class="number">2</span>);
         gradient<span class="operator">.</span>setFinalStop(rect()<span class="operator">.</span>right()<span class="operator">,</span> rect()<span class="operator">.</span>height()<span class="operator">/</span><span class="number">2</span>);
     } <span class="keyword">else</span> {
         gradient<span class="operator">.</span>setStart(rect()<span class="operator">.</span>width()<span class="operator">/</span><span class="number">2</span><span class="operator">,</span> rect()<span class="operator">.</span>top());
         gradient<span class="operator">.</span>setFinalStop(rect()<span class="operator">.</span>width()<span class="operator">/</span><span class="number">2</span><span class="operator">,</span> rect()<span class="operator">.</span>bottom());
     }
     painter<span class="operator">.</span>fillRect(event<span class="operator">-</span><span class="operator">&gt;</span>rect()<span class="operator">,</span> <span class="type"><a href="qbrush.html">QBrush</a></span>(gradient));
 }
</pre>
<p>In this example, a predefined gradient is set up differently
depending on the orientation of the handle. QSplitterHandle
provides a reasonable size hint for the handle, so the subclass
does not need to provide a reimplementation of <a href="qsplitterhandle.html#sizeHint">sizeHint</a>() unless the handle
has special size requirements.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSplitterHandle" />QSplitterHandle.__init__ (<i>self</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a>&#160;<i>o</i>, <a href="qsplitter.html">QSplitter</a>&#160;<i>parent</i>)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Creates a <a href="qsplitter.html">QSplitter</a> handle with the
given <i>orientation</i> and <a href="qsplitter.html">QSplitter</a>
<i>parent</i>.</p>


<h3 class="fn"><a name="closestLegalPosition" />int QSplitterHandle.closestLegalPosition (<i>self</i>, int&#160;<i>p</i>)</h3><p>Returns the closest legal position to <i>pos</i> of the splitter
handle. The positions are measured from the left or top edge of the
splitter, even for right-to-left languages.</p>
<p><b>See also</b> <a href="qsplitter.html#closestLegalPosition">QSplitter.closestLegalPosition</a>()
and <a href="qsplitterhandle.html#moveSplitter">moveSplitter</a>().</p>


<h3 class="fn"><a name="event" />bool QSplitterHandle.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="mouseMoveEvent" />QSplitterHandle.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>


<h3 class="fn"><a name="mousePressEvent" />QSplitterHandle.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p>


<h3 class="fn"><a name="mouseReleaseEvent" />QSplitterHandle.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p>


<h3 class="fn"><a name="moveSplitter" />QSplitterHandle.moveSplitter (<i>self</i>, int&#160;<i>p</i>)</h3><p>Tells the splitter to move this handle to position <i>pos</i>,
which is the distance from the left or top edge of the widget.</p>
<p>Note that <i>pos</i> is also measured from the left (or top) for
right-to-left languages. This function will map <i>pos</i> to the
appropriate position before calling <a href="qsplitter.html#moveSplitter">QSplitter.moveSplitter</a>().</p>
<p><b>See also</b> <a href="qsplitter.html#moveSplitter">QSplitter.moveSplitter</a>() and
<a href="qsplitterhandle.html#closestLegalPosition">closestLegalPosition</a>().</p>


<h3 class="fn"><a name="opaqueResize" />bool QSplitterHandle.opaqueResize (<i>self</i>)</h3><p>Returns true if widgets are resized dynamically (opaquely),
otherwise returns false. This value is controlled by the <a href="qsplitter.html">QSplitter</a>.</p>
<p><b>See also</b> <a href="qsplitter.html#opaqueResize-prop">QSplitter.opaqueResize</a>().</p>


<h3 class="fn"><a name="orientation" /><a href="qt.html#Orientation-enum">Qt.Orientation</a> QSplitterHandle.orientation (<i>self</i>)</h3><p>Returns the handle's orientation. This is usually propagated
from the <a href="qsplitter.html">QSplitter</a>.</p>
<p><b>See also</b> <a href="qsplitterhandle.html#setOrientation">setOrientation</a>() and
<a href="qsplitter.html#orientation-prop">QSplitter.orientation</a>().</p>


<h3 class="fn"><a name="paintEvent" />QSplitterHandle.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>


<h3 class="fn"><a name="resizeEvent" />QSplitterHandle.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>


<h3 class="fn"><a name="setOrientation" />QSplitterHandle.setOrientation (<i>self</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a>&#160;<i>o</i>)</h3><p>Sets the orientation of the splitter handle to
<i>orientation</i>. This is usually propagated from the <a href="qsplitter.html">QSplitter</a>.</p>
<p><b>See also</b> <a href="qsplitterhandle.html#orientation">orientation</a>() and <a href="qsplitter.html#orientation-prop">QSplitter.setOrientation</a>().</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QSplitterHandle.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>


<h3 class="fn"><a name="splitter" /><a href="qsplitter.html">QSplitter</a> QSplitterHandle.splitter (<i>self</i>)</h3><p>Returns the splitter associated with this splitter handle.</p>
<p><b>See also</b> <a href="qsplitter.html#handle">QSplitter.handle</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>